<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var nums=[1,2,3,1,23,3,5,4,8,9,6,8];

        
        var res = nums.filter(function(item,index) {
            var out = true;
            // if(sum.indexOf(item)==-1) {
            //    sum=sum+item;
            //    out = true;
            // }3
            for(var i=0;i<index;i++){
                if(item == nums[i]){
                    out = false;
                }
            }
           return out;
        });
        console.log(res);
    </script>

</body>
</html>